﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;

namespace ParticularLocal
{
    public class AsyncLocalPerson
    {
        static readonly AsyncLocal<Person> local = new AsyncLocal<Person>();

        public void SetCurrent(Person person)
        {
            lock (local)
            {
                if (local.Value == null)
                {
                    local.Value = person;
                }
            }

        }

        public Person GetPerson()
        {
            return local.Value;
        }
    }
}
